package a;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Date;

@WebServlet("/ServletRequestDemo2")
public class ServletRequestDemo2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.通过请求头的key 获取所对应的value User-Agent Cookie
        String agent = request.getHeader("User-Agent");
        System.out.println(agent);
        String cookie = request.getHeader("Cookie");
        System.out.println(cookie);
    }
}
